home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
games1
/
mjsolv12.zip
/
MJSOLVER.DOC
next >
Wrap
Text File
|
1993-03-03
|
19KB
|
357 lines
MJSOLVER v1.2
Copyright (C) 1990, 1991 by Ken McDonald
---------------------- What Is MJSolver? ----------------------
MJSolver is designed for use with Mah Jongg version 3.3 or
later, (C) by Nels Anderson. It's basic function is to rapidly
test any of the 65536 Mah Jongg boards for the best possible
score through a series of simulated plays.
MJSolver does not incorporate built-in hueristics or an AI
inference engine to conquer every mahjongg board encountered.
The main goal of MJSolver is to give some indication of the
degree of difficulty of one board relative to another. It can
also be used to determine whether a board can be won, and to
show the winning series of moves by autoplaying them with Mah
Jongg. This might be helpful in understanding how a particular-
ly difficult board can be solved. The conquering is left to the
Mah Jongg player. After all, that's the real point of playing,
right?
The method employed by MJSolver during the simulation trials
consists of random selection and removal of tile pairs, with
equal weight given to all valid moves. The results for each
simulation are tracked so that the statistics for any number of
simulations can be determined upon completion. As with any ran-
dom sampling technique, the accuracy of the statistics for a
particular board will improve as the number of simulations per-
formed increases. The sequence of moves resulting in the best
score during the simulation process is saved in memory so that
the move info can be passed on to Mah Jongg for autoplay, or
saved to a disk file for later retreival and playback.
The random method employed produces a good indicator as to
the degree of difficulty of any board, but is not a very strong
technique with regard to winning the board. The reason for this
lies in the fact that their are a vast number of possible move
paths that can be taken for each board. If, for example, at any
given move juncture there are on average 8 possible moves, and
40 moves can be played per game on average, then the number of
different possible move paths would be 8 raised to the 40th
power, or roughly 1 with 36 zeros after it. If only a few of
these paths lead to winning the board, an awful lot of simula-
tions will have to be run to ferret them out. Luckily, a signi-
ficant percentage of most of the board's move paths result in a
winning sequnce of moves.(Approximately 83% of the 65536 boards
can be won after 2000 simulations!).
After a person plays Mah Jongg for a while he begins to dev-
elop certain strategies based on his past playing experience.
Therefore, there will be cases when MJSolver shows a board to
be winnable 50% of the time but it takes you 5 tries to win it
manually. Of course, the reverse will also occur. This is be-
cause your strategy has biased the probabilty of winning one
way or the other relative to the random play statistics.
--------------- Shareware Notice and Disclaimer ---------------
MJSOLV12 is hereby released as shareware. If you enjoy this
product and decide to keep using it, please send the suggested
registration price of $5.00 (in U.S. funds only, please) to me
at the address found at the end of this document. A copy of the
latest version of the software, with your name as registered
user in the title page, will be sent upon receipt of the above
registration fee. See MJSOLVER.ORD for more details on how to
order.
You may freely distribute MJSOLV12 (and are even encouraged
to do so) provided that the following files are included intact
and in an unedited form within the archived package:
MJSOLVER.EXE - the main MJSolver program
MJSOLVER.DOC - this document
MJSOLVER.HIS - a history of program improvements
MJSOLVER.ORD - a printer ready order form
SETUP.MJS - a default MJSolver Setup File
The archiving method may be changed as necessary, however no
other alterations, additions or deletions are authorized.
While MJSOLV12 is designed for use with Mah Jongg, it is not
to be considered as part of the Mah Jongg program, and may not
be bundled with this, or any other software package without the
express permission of the author.
This software is released in as is condition. Although it
has been tested on several different hardware configurations,
there is simply no way to guarantee it's performance or com-
patibility on every possible setup. The author will therefore
accept no responsibility nor liability for any damage arising
from it's use or distribution and does hereby disclaim any
warranties, either implied or expressed.
------------------------ What It Does -------------------------
How many times have you started a Mah Jongg game only to run
out of plays after removing only 20 or 30 tiles? How about all
those games that have ended with only 2 (or 4, or 16) tiles re-
maining? Have you ever wondered how many of these boards could
actually be completed? Now MJSolver can help you finish some of
the boards that you might otherwise have given up on!
MJSolver will rapidly run as many as 65535 simulated plays
on any selected board, while presenting a running tally of it's
progress. After running the simulations, you may decide to play
the board yourself or, if you'd rather, allow MJSolver to show
you the best solution that it came up with.
----------------------- Using MJSolver ------------------------
MJSolver may be run on either a floppy or hard drive based
system. Additional disk storage space may be required for the
following reasons:
1. It is desired to save solved board move sequences.
2. A custom setup file is created and saved to disk.
3. An alternate Mah Jongg statistics file name is
specified.
See the "defaults" information below, as well as the "Menu
Options" selection for details.
To start MJSolver, simply type "MJSOLVER <CR>" at the DOS
prompt. There are a number of valid parameters which may also
be entered at this time, which are detailed below. Any or all
of these parameters may be passed to MJSolver from the command
line or a batch file. To see a list of all parameters, type the
following from the DOS prompt: MJSOLVER ? <CR>
Note: The symbol "<CR>" is used in this document to signify a
carriage return.
You will then see an example of the syntax as well as a
brief explanation of the type of information MJSolver expects
for each parameter. As indicated above, use of these parameters
is optional. If any of this information is omitted, or if there
is anything included that MJSolver doesn't understand, certain
defaults will be used as explained below.
------------------- Command Line Parameters -------------------
PARA- | |
METER | EXPLATION/EXAMPLES | DEFAULT
-------+---------------------------------------------+---------
-bx | Specifies the board number you would like | RANDOM
| MJSolver to test. Valid arguments for "x" | NUMBER
| are any number from 0 to 65535, inclusive. |
| |
| EXAMPLE: -b37847 |
-------+---------------------------------------------+---------
PARA- | |
METER | EXPLATION/EXAMPLES | DEFAULT
-------+---------------------------------------------+---------
-sfx | Name of MJSolver setup file to load. | SETUP
| |
| EXAMPLE: -sfSETUP2 |
-------+---------------------------------------------+---------
-sx | The number of simulations you wish to run. | 1000
| Enter any value from 1 to 65535 for "x". |
| |
| EXAMPLE: -s25000 |
-------+---------------------------------------------+---------
-pax | Tells MJSolver where Mah Jongg is located. | none
| This may be needed if the Mah Jongg files |
| are in a different drive and/or directory |
| than that which MJSolver was run from. |
| |
| Note: MJSolver will automatically search |
| the current directory, all directories in |
| your PATH, and the directory that MJSolver |
| itself resides in for MAHJONGG.EXE. |
| |
| EXAMPLE: -paC:\GAMES\MAHJONGG |
-------+---------------------------------------------+---------
-px | Insert up to a 5 second delay between moves | 1
| in the (A)uto Play feature. Enter any num- |
| ber from 0 to 5000, in milliseconds. |
| |
| EXAMPLE: -p2000 |
-------+---------------------------------------------+---------
-------+---------------------------------------------+---------
-q | During the simulations, MJSolver will beep | BEEP ON
| upon finding a winning sequence of moves. |
| Using the "-q" parameter will suppress the |
| beep, running MJSolver in "quiet" mode. |
-------+---------------------------------------------+---------
<mjs> | Any non-standard settings you wish to pass | n/a
| to MAHJONGG.EXE should also be included, if |
| the board is to be played following the |
| simulations. In general, any options you |
| would normally specify (either from the DOS |
| prompt or via a batch file) when starting |
| Mah Jongg should also be entered here. |
| |
| EXAMPLE: -n -y -uWB |
-------+---------------------------------------------+---------
Any optional information you pass to MJSolver is processed
in the same order entered. If you intend to override any of the
information contained in the setup file, you will need to enter
these items after the "-sfx" parameter (if used) on the command
line. No other order of entry is necessary.
-------------------- The MJSolver Display ---------------------
Once MJSolver is running, a title screen will be displayed
containing copywrite and registration information. Hit any key
to go directly to the main screen and begin the simulations.
On this screen you will see all data pertaining to or gen-
erated from the simulations: the board number currently being
tested; the number of simulations completed; the score for the
last test performed; the best and worst scores encountered so
far; and the average score of all simulations completed on this
board. At the bottom of the screen is a message bar indicating
the number of simulations to be performed, and the option to
"Press `Q' to Quit". If you decide not to complete the full set
of simulations, you may halt the program at any time by hitting
either "Q" or <ESC>. Testing may be resumed by hitting <CR>.
------------------------ Menu Options -------------------------
Once finished with the simulations, the message bar will be
replaced with a menu offering the options listed below. Typing
the highlighted letter selects that option. <ESC> will cancel.
Next - Allows you to run simulations on the next, or any other
board. Typing "N" will display the next board number.
You may edit the number displayed or hit <ESC> to clear
the entry field and then type in a new number. Hit <CR>
to accept the board and begin simulations.
Play - Offers the options for playing the board following sim-
ulations. Select "Manual" for normal gameplay or "Auto"
to have MJSolver show you the best solution arrived at
during simulations. If a winning sequence of moves was
found during simulations, the final tile pair will not
be removed by MJSolver in Auto-play mode. The purpose
of this is to allow you to replace tiles and manually
play from any point you may choose.
Setup - Allows editing of the active configuration or any saved
setup file loaded from the "File" sub-menu. The <PgUp>,
<PgDn> or <CR> keys can be used to move between fields.
No actual editing of the text is needed for any option
which shows the up/down arrow. You may toggle among the
legal values for these settings using the up and down
cursor keys. All others are to be edited as text, using
insert mode only. Certain of these strings may be long-
er than their entry fields. The text may be scrolled to
the left or right while editing, with an arrow shown to
indicate the direction in which any overrun exists.
Note: Any setup changes made will be in effect for the
current session only, unless saved to disk as described
below. A default file called 'setup' is automatically
loaded at program startup, but must be manually saved
upon program termination for changes to be permanent.
File - Accesses the sub-menu from which any Settings or Board
file may be loaded or saved to disk. A default file-
name will be supplied in either case. For a Board file,
the form "bd_xxxxx" is used, where "xxxxx" is a five
digit representation of the board number. The default
for a Settings file is "setup". You may edit either of
the supplied filenames or hit <ESC> to clear the field
and then enter one of your own choice. If <ESC> is hit
twice in succession, you will be returned to the main
menu with the file string intact.
Note: It is not necessary to include an extension when
entering a filename. MJSolver automatically adds ".MJS"
for Settings files, and ".MJB" for Board files.
Exit - Quits MJSolver and exits to DOS. (All other selections
return you to the "options" screen upon completion.)
F10 - Boss Mode, shells out to DOS. No indication is given
that the shell was spawned from MJSolver so make sure
to type exit to return to MJSolver or you will run out
of memory.
<CR> - Restarts simulations on the same board, adding to the
statistics from the previous run, even after the board
has been manually or automatically played. Useful if a
winning board has not been found after the first round
of simulating.
--------------------- The STATISTICS File ---------------------
MJSolver will tell Mah Jongg to save statistics generated
from games played through MJSolver to a file named MJSOLVER.STA
located in the same directory as Maj Jongg. The purpose of this
is to keep from "padding" your Maj Jongg statistics file (e.g.-
MAHSTATS) with info generated by MJSolver. This default can be
overridden by changing the statistics file name in the Setup
menu. It can also be changed by using the "-fn" parameter on
MJSolver's command line. (e.g "-f/mahstats") See MAHJONGG.DOC
for more info.
-------------------- Registering MJSolver ---------------------
I certainly hope that you enjoy using this product and that
it proves to be a valuable utility. If so, the $5.00 suggested
registration fee would be much appreciated and would provide
encouragement to further refine and improve this product.
Please include any comments and/or suggestions and mail to:
Ken McDonald
P.O. Box 654
Walled Lake, MI 48390-0654
I may also be reached by calling LIBERTY BBS in Mt. Clemens,
Michigan at (313) 792-4911 (300/1200/2400 baud - N81). Any cor-
respondence should be addressed to Cap'n Smith, user #7, and
will be forwarded to me.